import Ember from 'ember';

export function findPrize(params/*, hash*/) {
	const prizes = params[0];
	const position = params[1];
	let prize = null;
	if (prizes && position >= 0) {
		Ember.$(prizes).each(function () {
			if (this.startPosition <= position && this.endPosition > position) {
				prize = this;
				return false; //结束循环
			}
		});
	}

	return prize && prize.prizeName;
}

export default Ember.Helper.helper(findPrize);
